package com.yc.sole.erp.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import com.yc.sole.common.enums.IBaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author yizuomin
 * @date 2023/5/7 21:41
 **/
@Getter
@AllArgsConstructor
public enum OrderState implements IBaseEnum<String> {

    /**
     *
     */
    UN_HANDLE("0", "待处理"),
    PROCESSING("1", "生产中"),
    OUTSOURCED("2", "外发中"),
    COMPLETED("3", "已完成"),
    CANCELED("4", "已取消");

    @JsonValue
    private final String value;
    private final String description;

    /**
     * @param value
     * @return
     */
    public static String getByValue(String value) {
        for (OrderState orderState : OrderState.values()) {
            if (orderState.value.equals(value)) {
                return orderState.getDescription();
            }
        }
        return null;
    }
}
